import service from "@/api/index.js";
const categoryApi={
    //添加
    inster(caregory){
        service.post("/category",caregory);
    },
    delete(id){
        return service.delete(`/category/${id}`);
    },
    //修改
    update(category){
        return service.put('/category',category);
    },
    selectByPage(condition,pageNum,pageSize){
        if(pageNum){
            condition.pageNum = pageNum;
        }
        if (pageSize){
            condition.pageSize = pageSize;
        }

        return service.get("/category/search",{
            params: condition
        })
    },
    selectById(id){
        return service.get(`/category/${id}`);
    },
    selectAllParent(){
        return service.get("/category/allparent");
    }
};


export default categoryApi;